<!doctype html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport"
          content="width=device-width, user-scalable=no, initial-scale=1.0, maximum-scale=1.0, minimum-scale=1.0">
    <meta http-equiv="X-UA-Compatible" content="ie=edge">
    <script src="https://cdn.jsdelivr.net/npm/axios/dist/axios.min.js"></script>
    <link rel="stylesheet"
          href="	https://cdn.jsdelivr.net/npm/bootstrap@5.3.0-alpha1/dist/css/bootstrap.min.css">
    <script src="https://cdn.jsdelivr.net/npm/bootstrap@5.3.0-alpha1/dist/js/bootstrap.bundle.min.js"></script>
    <script src="https://unpkg.com/vue@3/dist/vue.global.js"></script>
    <title>Document</title>
</head>
<body>
<div id="app">
    <div class="container">
        <form>
            <div class="mb-3">
                <label for="exampleInputEmail1"
                       class="form-label">账号</label>
                <input class="form-control"
                       id="exampleInputEmail1"
                       aria-describedby="emailHelp">
            </div>
            <div class="mb-3">
                <label for="exampleInputPassword1"
                       class="form-label">密码</label>
                <input type="password" class="form-control"
                       id="exampleInputPassword1">
            </div>
            <button type="submit" class="btn btn-primary"
                    @click.prevent="handleClick()">
                Submit
            </button>
        </form>
    </div>
</div>
</body>
<script>
    const {createApp, ref} = Vue

    createApp({
        setup() {
            const message = ref('Hello vue!')
            return {
                message
            }
        },
        methods: {
            async handleClick() {
                try {
                    // Use Axios to send a POST request to your login endpoint
                    const response = await axios.post('http://localhost:8080/login', {
                        username: this.username,
                        password: this.password
                    });

                    // Handle the response from the server
                    console.log(response.data);
                } catch (error) {
                    // Handle errors, such as displaying an error message
                    console.error('Login failed', error);
                }
            }
        }
    }).mount('#app')
</script>
</html>